import bcrypt


# 加密密码
def password_hash(passwd):
    return bcrypt.hashpw(passwd, bcrypt.gensalt())


# 验证密码
def password_verify(passwd, hashed):
    return bcrypt.checkpw(passwd, hashed)


if __name__ == '__main__':
    password = "Password@2025".encode('utf-8')
    hashed = '$2a$10$iAcZL84hcp42O8AYt5cWuuRh1XIEYdL6ACuUfrUutlUKzdh7/b8OK'.encode('utf-8')
    print('password=' + str(password))
    print('hashed=' + str(hashed))
    print(password_hash(password))
    print(password_verify(password, hashed))
